package bdqn.t09.controller;

import bdqn.t09.pojo.AsContacts;
import bdqn.t09.pojo.AsCustoms;
import bdqn.t09.service.AsContactsService;
import bdqn.t09.service.AsCustomsService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class AgentController {

    @Resource
    private AsCustomsService asCustomsService;

    @Resource
    private AsContactsService asContactsService;

    //跳转代理商客户管理
    @RequestMapping("/asCustoms")
    public String goasCustomsUpdade(){
        return  "agentCustomerManagement";
    }


    @RequestMapping("/asCustomsShow")
    public String toasCustomsShow(Long id, Model model){
        AsCustoms asCustoms = asCustomsService.selectByPrimaryKey(id);
        List<AsContacts> asContacts = asContactsService.selectByPrimaryCustomId(asCustoms.getId());
        model.addAttribute("asContacts",asContacts);
        model.addAttribute("asCustoms",asCustoms);
        return "viewCustomerInformation";
    }
}